import request from '@/common/utils/request'

/**
 * 获取-员工列表
 * @returns
 */
export const getSysUserApi = (params) => {
    return request({
        url: '/sys/user',
        method: 'GET',
        params
    })
}

/**
 * 获取-员工-基本信息
 * @returns
 */
export const getSysUserIdApi = (data) => {
    return request({
        url: `/sys/user/${data.id}`,
        method: 'GET'
    })
}


/**
 * 分配-员工-角色
 * @returns
 */
export const putSysUserAssignRoles = (data) => {
    return request({
        url: "/sys/user/assignRoles",
        method: "PUT",
        data
    })
}


/**
 * 批量-导出员工excel
 * @returns
 */
export const getSysUserExcelApi = () => {
    return request({
        url: '/sys/user/export',
        method: 'GET',
        // 改变接收数据的类型
        responseType: 'blob', // 使用 blob 接收二进制文件流
    })
}


/**
 * 修改-员工-基本信息
 * @returns
 */
export const putSysUserIdApi = (data) => {
    return request({
        url: `/sys/user/${data.id}`,
        method: 'PUT',
        data
    })
}

/**
 * 新增-员工
 * @returns
 */
export const postSysUserApi = (data) => {
    return request({
        url: `/sys/user`,
        method: 'POST',
        data
    })
}



/**
 * 批量-下载导入员工模板
 * @returns
 */
export const getSysUserImportTemplateApi = () => {
    return request({
        url: '/sys/user/import/template',
        method: 'GET',
        // 改变接收数据的类型
        responseType: 'blob', // 使用 blob 接收二进制文件流
    })
}

/**
 * 批量-导入员工-(上传excel)
 * @returns
 */
export const postSysUserImportApi = (data) => {
    return request({
        url: '/sys/user/import',
        method: 'POST',
        data
    })
}

/**
 * 删除-员工
 * @returns
 */
export const deleteSysUserIdApi = (id: string) => {
    return request({
        url: `/sys/user/${id}`,
        method: 'DELETE'
    })
}